#include <stx/test/test.hpp>

TEST_CASE (core_random)
{
    CHECK(genUuidString() != genUuidString());
    auto ints  = std::vector{1, 2, 3, 4, 5, 6, 7, 8, 9, 0};
    auto ints2 = ints;
    shuffle(ints2);
    CHECK(ints != ints2);

    LOOP_N (100)
    {
        auto const max_len = rand(2uz, 100uz);
        CHECK(genRandBuffer(1uz, max_len).size() <= max_len);
        CHECK(genRandBuffer(1uz, max_len).size() >= 1);
        CHECK(genRandString(1uz, max_len).size() <= max_len);
        CHECK(genRandString(1uz, max_len).size() >= 1);
    }

    auto stat = Map<int, std::size_t>{};

    LOOP_N (100000)
    {
        ++stat[rand(0, 9)];
    }

    CHECK(stat.size() == 10);
    CHECK(ranges::all_of(stat,
                         [](auto const& item)
                         {
                             return item.first >= 0 && item.first <= 9 &&
                                    item.second > 9500 && item.second < 10500;
                         }));
}